<template>
  <div >
    <u-calendar :show="showDate" :defaultDate="dateArr" :mode="mode" @confirm="confirm" @close="handleClose"></u-calendar>
  </div>
</template>

<script>
export default {
  name: '',
  props: {
    showDate: {
      type: Boolean,
      default: false
    },
    signerInfo:{
      type: Object,
      default: () => ({})
    },
    mode: {
      type: String,
      default: 'single'
    }
  },
  data() {
    return {
      dateArr: new Date()
    }
  },
  watch:{
    showDate(val){
      if(val){
        const fieldValue = this.signerInfo.fieldValue;
        this.dateArr = fieldValue ?   [fieldValue] : new Date()
      }
    }
  },
  methods: {
    handleClose(){
     this.$emit("closeFun", false);
    },
    confirm(val){
      let obj = this.signerInfo
      obj.fieldValue = val[0]
      this.$emit("save", obj);
     this.handleClose();
    }
  },
  created() {
    
  },
}
</script>

<style lang='less' scoped>
  
</style>